package org.msfj.admin.model;

import org.msfj.common.base.BaseModel;

import javax.persistence.Column;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Objects;

/**
 * 表单域
 */
@Table(name = "admin_form_field")
public class FormField extends BaseModel implements Serializable {


    @Column(name = "key_")
    private String key;
    @Column(name = "label_")
    private String label;
    @Column(name = "default_value_")
    private String defaultValue;
    @Column(name = "input_type")
    private Integer inputType;
    @Column(name = "require_")
    private Boolean require;
    @Column(name = "regex_")
    private String regex;
    @Column(name = "placeholder_")
    private String placeholder;
    @Column(name = "regex_error")
    private String regexError;
    @Column(name = "option_dic")
    private String optionDic;
    @Column(name = "category_id")
    private String categoryId;
    @Column(name = "flag_history_value")
    private Boolean flagHistoryValue;

    public Boolean getFlagHistoryValue() {
        return flagHistoryValue;
    }

    public void setFlagHistoryValue(Boolean flagHistoryValue) {
        this.flagHistoryValue = flagHistoryValue;
    }

    public String getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    }

    public String getOptionDic() {
        return optionDic;
    }

    public void setOptionDic(String optionDic) {
        this.optionDic = optionDic;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public Integer getInputType() {
        return inputType;
    }

    public void setInputType(Integer inputType) {
        this.inputType = inputType;
    }

    public Boolean getRequire() {
        return require;
    }

    public void setRequire(Boolean require) {
        this.require = require;
    }

    public String getRegex() {
        return regex;
    }

    public void setRegex(String regex) {
        this.regex = regex;
    }

    public String getPlaceholder() {
        return placeholder;
    }

    public void setPlaceholder(String placeholder) {
        this.placeholder = placeholder;
    }

    public String getRegexError() {
        return regexError;
    }

    public void setRegexError(String regexError) {
        this.regexError = regexError;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        FormField formField = (FormField) o;
        return Objects.equals(key, formField.key) &&
                Objects.equals(label, formField.label) &&
                Objects.equals(defaultValue, formField.defaultValue) &&
                Objects.equals(inputType, formField.inputType) &&
                Objects.equals(require, formField.require) &&
                Objects.equals(regex, formField.regex) &&
                Objects.equals(placeholder, formField.placeholder) &&
                Objects.equals(regexError, formField.regexError);
    }

    @Override
    public int hashCode() {
        return Objects.hash(key, label, defaultValue, inputType, require, regex, placeholder, regexError);
    }
}
